package club.hicode.spring.main;

import club.hicode.spring.factory.BeanDefinition;
import club.hicode.spring.factory.BeanFacotry;
import club.hicode.spring.impl.AutowiredBeanFactroy;
import club.hicode.spring.info.PropertieValue;
import club.hicode.spring.info.PropertieValues;

/**
 * 测试运行类
 *
 * @author Liu Chunfu
 * @date 2018-04-26 下午4:09
 **/
public class MyRun {

    public static void main(String[] args) {
        //1.create bean definition
        BeanDefinition beanDefinition = new BeanDefinition();
        beanDefinition.setBeanClassName("club.hicode.spring.main.Person");

        //2. propretie
        PropertieValue idValue = new PropertieValue("id", "123");
        PropertieValue nameValue = new PropertieValue("name", "liuchunfu");
        PropertieValues values = new PropertieValues();
        values.addPropertie(idValue);
        values.addPropertie(nameValue);
        beanDefinition.setValues(values);

        //3. create factory
        BeanFacotry beanFacotry = new AutowiredBeanFactroy();
        beanFacotry.registerBean("person", beanDefinition);

        Person person = (Person) beanFacotry.getBean("person");
        System.out.println(person);

    }
}
